package cn.lg.soar.system.biz.modules.auth.model;

import cn.lg.soar.system.biz.modules.auth.entity.Menu;
import lombok.Getter;
import lombok.Setter;

import java.util.List;

/**
 * @author luguoxiang
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
@Getter
@Setter
public class MenuVo extends Menu {

    private static final long serialVersionUID = 3410574829954698131L;

    private List<Integer> permitIds;

    private List<MenuVo> permits;

    public MenuVo() {
    }

    public MenuVo(Menu menu) {
        this.setId(menu.getId());
        this.setType(menu.getType());
        this.setTitle(menu.getTitle());
        this.setCode(menu.getCode());
        this.setPath(menu.getPath());
        this.setRedirect(menu.getRedirect());
        this.setComponent(menu.getComponent());
        this.setIcon(menu.getIcon());
        this.setStatus(menu.getStatus());
        this.setHideChildren(menu.getHideChildren());
        this.setShared(menu.getShared());
        this.setKeepalive(menu.getKeepalive());
        this.setSort(menu.getSort());
        this.setTenantId(menu.getTenantId());
        this.setParentId(menu.getParentId());
        this.setCreateTime(menu.getCreateTime());
        this.setCreateBy(menu.getCreateBy());
        this.setUpdateTime(menu.getUpdateTime());
        this.setUpdateBy(menu.getUpdateBy());
    }

    public Menu toMenu() {
        Menu target = new Menu();

        target.setId(this.getId());
        target.setType(this.getType());
        target.setTitle(this.getTitle());
        target.setCode(this.getCode());
        target.setPath(this.getPath());
        target.setRedirect(this.getRedirect());
        target.setComponent(this.getComponent());
        target.setIcon(this.getIcon());
        target.setStatus(this.getStatus());
        target.setHideChildren(this.getHideChildren());
        target.setShared(this.getShared());
        target.setKeepalive(this.getKeepalive());
        target.setSort(this.getSort());
        target.setTenantId(this.getTenantId());
        target.setParentId(this.getParentId());
        target.setCreateTime(this.getCreateTime());
        target.setCreateBy(this.getCreateBy());
        target.setUpdateTime(this.getUpdateTime());
        target.setUpdateBy(this.getUpdateBy());

        return target;
    }
}
